using System;
using System.Collections.Generic;
using System.Text;
using Objects;

namespace DAL
{
    public class DALDanhSachTheMua
    {
        public List<DanhSachTheMua> GetAllItem(DateTime ngayDangKy, int idKhachHang)
        {
            List<DanhSachTheMua> ListDanhSachTheMua = new List<DanhSachTheMua>();

            clsDataAccess acc = new clsDataAccess();

            string[] sname = new string[] { "@NgayDangKy", "@idKhachHang" };
            string[] vname = new string[] { ngayDangKy.ToString(),idKhachHang.ToString() };
            System.Data.DataSet ds = acc.CommandSelect("DanhSachTheMua_GetAllItem", sname, vname);

            DanhSachTheMua Item = new DanhSachTheMua();

            for (int i = 0; i < ds.Tables[0].Rows.Count; i++)
            {
                System.Data.DataRow dr = ds.Tables[0].Rows[i];
                ListDanhSachTheMua.Add((Item.Populate(dr)));
            }
            return ListDanhSachTheMua;
        }


        public List<DanhSachTheMua> GetByIdKhachHang(int IdKhachHang)
        {
            List<DanhSachTheMua> ListDanhSachTheMua = new List<DanhSachTheMua>();

            clsDataAccess acc = new clsDataAccess();

            string[] sname = new string[] { "@IdKhachHang" };
            string[] vname = new string[] { IdKhachHang.ToString() };
            System.Data.DataSet ds = acc.CommandSelect("DanhSachTheMua_GetByIdKhachHang", sname, vname);

            DanhSachTheMua Item = new DanhSachTheMua();

            for (int i = 0; i < ds.Tables[0].Rows.Count; i++)
            {
                System.Data.DataRow dr = ds.Tables[0].Rows[i];
                ListDanhSachTheMua.Add((Item.Populate(dr)));
            }
            return ListDanhSachTheMua;
        }
    }
}
